博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Flask的基本操作知识
阅读量:6864 次
发布时间:2019-06-26

本文共 1063 字,大约阅读时间需要 3 分钟。

https://study.163.com/course/courseLearn.htm?courseId=1005913008&from=study#/learn/video?lessonId=1053446514&courseId=1005913008

学习了flask的基本知识,做下笔记

首先创建项目后在编辑结构里勾选上单一实例和DEBUG。

1 from flask import Flask, render_template, request, redirect 2  3 app = Flask(__name__) 4  5  6 @app.route('/') 7 def hello_world(): 8     # 通过url传递参数 9     wd = request.args.get('wd')10     age = request.args.get('age')11     print(wd)12     print(age)13     return '好好学习'+wd14 15 16 @app.route('/index', methods=['GET', 'POST'])17 def index():18     # 表单参数传递19     if request.method == 'GET':20         return render_template('index.html')21     else:22         tel = request.form.get('tel')23         pwd = request.form.get('pwd')24         print('tel:%s'%tel)25         print('pwd:%s'%pwd)26         # 重定向27         return redirect('/profile/')28 29 30 @app.route('/profile/')31 def profile():32     return "个人中心页面"33 34 35 if __name__ == '__main__':36     app.run()

index的代码

  

登录窗口界面

 

转载于:https://www.cnblogs.com/weiwei2016/p/10167364.html

你可能感兴趣的文章
sql 集合查询 数据更新操作语句
查看>>
静态内部类
查看>>
localStorage使用总结
查看>>
计算一年中的第几天
查看>>
iOS 一句话获取日期和星期几
查看>>
【javascript】Lazy Load, 延迟加载图片的 jQuery 插件
查看>>
Percona XtraDB Cluster高可用与状态快照传输(PXC 5.7 )
查看>>
OBJECT_ID 技巧整理
查看>>
Date日期类,Canlendar日历类,Math类,Random随机数学类
查看>>
java中forName()的作用
查看>>
解决oracle_4031错误的方法
查看>>
C# Out,Ref 学习总结
查看>>
CentOS 7.4如何安装Python3
查看>>
instanceof
查看>>
activity的四种模式
查看>>
z-index
查看>>
git 和github
查看>>
Vue的路由
查看>>
RESTful API
查看>>
mysql之select(二)
查看>>